package cz.muni.fi.pa165.sportclubmanager.dto;

import cz.muni.fi.pa165.sportclubmanager.entity.AgeCategory;

/**
 *
 * @author Michal Prokeš, 72758
 */
public class AgeCategoryDTOMapping {
    
    /**
     * Map AgeCategoryDTO to AgeCategory entity
     * @param dto AgeCategoryDTO object
     * @return AgeCategory entity
     */
     public static AgeCategory toEntity(AgeCategoryDTO dto) {
        if(dto==null) { return null; }
        
        AgeCategory entity = new AgeCategory();
        
        entity.setId(dto.getId());
        entity.setAgeFrom(dto.getAgeFrom());    
        entity.setAgeTo(dto.getAgeTo());
        entity.setName(dto.getName());
        
        return entity;
    }
     
     
    /**
     * Map AgeCategoryDTO to AgeCategory entity
     * @param entity AgeCategoryDTO object
     * @return AgeCategory entity
     */
     public static AgeCategoryDTO toDto(AgeCategory entity) {
        if(entity==null) { return null; }
        
        AgeCategoryDTO dto = new AgeCategoryDTO();
        dto.setId(entity.getId());
        dto.setAgeFrom(entity.getAgeFrom());
        dto.setAgeTo(entity.getAgeTo());
        dto.setName(entity.getName());
        
        return dto;
    }
     
            
    
}
